import UserLogin from '../views/user/UserLogin.vue';
import http from './http';

// 鱼类种类相关接口
export const fishSpeciesApi = {
  // 获取所有鱼类种类
  getAll: () => http.get('/api/fish-species'),
  
  // 添加新鱼类
  add: (data) => http.post('/api/fish-species', data),
  
  // 更新鱼类信息
  update: (id, data) => http.put(`/api/fish-species/${id}`, data),
  
  // 删除鱼类
  delete: (id) => http.delete(`/api/fish-species/${id}`)
};

// 渔业分布相关接口
export const fishDistributionApi = {
  // 获取所有渔业分布区域
  getAll: () => http.get('/api/fish-distributions'),
  
  // 添加新分布区域
  add: (data) => http.post('/api/fish-distributions', data),
  
  // 更新分布区域信息
  update: (id, data) => http.put(`/api/fish-distributions/${id}`, data),
  
  // 删除分布区域
  delete: (id) => http.delete(`/api/fish-distributions/${id}`)
};

// 渔业产量相关接口
export const fishProductionApi = {
  // 获取渔业产量数据
  getAll: () => http.get('/api/fish-production'),
  
  // 获取区域产量分布数据
  getRegional: () => http.get('/api/fish-production/regional'),
  
  // 获取鱼类产量占比数据
  getSpecies: () => http.get('/api/fish-production/species')
};

// 生态环境分析相关接口
export const ecologicalApi = {
  // 获取水质指标数据
  getWaterQuality: () => http.get('/api/ecological/water-quality'),
  
  // 获取生物多样性数据
  getBiodiversity: () => http.get('/api/ecological/biodiversity'),
  
  // 获取污染指标数据
  getPollution: () => http.get('/api/ecological/pollution'),
  
  // 获取环境因素影响数据
  getImpactFactors: () => http.get('/api/ecological/impact-factors'),
  
  // 获取生态保护区分布数据
  getProtectionZones: () => http.get('/api/ecological/protection-zones'),
  
  // 获取生态环境因素数据
  getFactors: () => http.get('/api/ecological/factors')
};

// 数据概览相关接口
export const dashboardApi = {
  // 获取统计数据
  getStatistics: () => http.get('/api/dashboard/statistics'),
  
  // 获取产量趋势数据
  getProductionTrend: () => http.get('/api/dashboard/production-trend'),
  
  // 获取分布情况数据
  getDistribution: () => http.get('/api/dashboard/distribution'),
  
  // 获取鱼类种类占比数据
  getSpeciesProportion: () => http.get('/api/dashboard/species-proportion')
}; 

// 用户接口
export const userApi = {
  // 用户登录
  userLogin: (data) => http.post('/api/user/login', data),

  // 用户注册
  userRegister: (data) => http.post('/api/user/register', data),

  // 获取用户信息
  getUserInfo: () => http.get('/api/user/info'),

  // 更新用户信息
  updateUser: (data) => http.put('/api/user/update', data),

  // 上传头像
  uploadAvatar: (file) => {
    const formData = new FormData();
    formData.append('image', file);
    return http.post('/api/upload', formData);
  }
}; 